﻿ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 坦克大战
{
    enum GameState
    {
        Running,
        GameObver
    }

    internal class GameFrameWork
    {
        private static GameState state=GameState.Running;
        public static Graphics g;
        public static void Start()
        {
            SoundManager.InitSound();
            GameObjectManager.Start();
            GameObjectManager.CreateMap();
            GameObjectManager.CreateMyTank();
            SoundManager.PlayStart();
        }

        public static void Update()
        {
            
            if (state == GameState.Running)
            {
                GameObjectManager.Update();
            }
            else if(state == GameState.GameObver)
            {
                GameOverUpdate();
            }

        }

        private static void GameOverUpdate()
        {
            Bitmap bmp=  Properties.Resources.GameOver;
            bmp.MakeTransparent(Color.Black);
            int x = 450 / 2 - Properties.Resources.GameOver.Width / 2;
            int y= 450 / 2 - Properties.Resources.GameOver.Height / 2;
            g.DrawImage(Properties.Resources.GameOver, x, y);
        }

        public static void ChangeToGameOver()
        {
            state=GameState.GameObver;
        }


    }
}
